﻿using System;
namespace Producers.Ehma10000000.Xtee.Riik.Ee.Producer.Ehma10000000 {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="omt1", Namespace="http://producers.ehma-10000000.xtee.riik.ee/producer/ehma-10000000", Target=typeof(Omt1))]
    public class Omt1Serializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IOmt1 clazz;
        
        public Omt1Serializer(IOmt1 clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("rafpayo");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "decimal");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdDecimal(((decimal)(clazz.Rafpayo))).ToString());
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="rafpayo") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>omt1>rafpayo");
                }
                clazz.Rafpayo = new global::Xtee.Core.Schema.XsdDecimal(Reader.ReadElementString("rafpayo")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>omt1>rafpayo", Reader.LocalName);
            }
        }
    }
}
